﻿<Window x:Class="TileEditor.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tilec="clr-namespace:TileEditorControls;assembly=TileEditorControls"
    Title="TileEditor 0.1" Width="600" Height="400"> 
    <Window.CommandBindings>
        <CommandBinding Command="Close" CanExecute="ExitCommandBinding_CanExecute" Executed="ExitCommandBinding_Executed" />
        <CommandBinding Command="New"   CanExecute="NewCommandBinding_CanExecute" Executed="NewCommandBinding_Executed" />
        <CommandBinding Command="Save" CanExecute="SaveCommandBinding_CanExecute" Executed="SaveCommandBinding_Executed" />
    </Window.CommandBindings>
    
    <DockPanel>
        <Menu x:Name="MainMenu" DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Header="_New" Command="New"/>
                <MenuItem Header="_Save" Command="Save" />
                <Separator />
                <MenuItem Header="E_xit" Command="Close"/>
            </MenuItem>
            <MenuItem Header="_Map">
                <MenuItem Header="_Size..." Click="MenuItem_Click"/>
                <Separator />
                <MenuItem Header="_Clear Map" />
            </MenuItem>

        </Menu>
        <StatusBar x:Name="Status" DockPanel.Dock="Bottom">
            <TextBlock>CurrentCell: </TextBlock>
            <TextBlock Text="{Binding ElementName=testGrid, Path=CurrentCell}" />
            <TextBlock>CurrentColor:</TextBlock>
            <Rectangle x:Name="CurrentColorStatus" Width="10" Height="10"
                       Fill="{Binding ElementName=testGrid, Path=CurrentBrush}"
                       ></Rectangle>
        </StatusBar>
        <Border BorderThickness="10" BorderBrush="Black" DockPanel.Dock="Left" CornerRadius="5">
            <Viewbox>
                <tilec:TileEditorGrid x:Name="testGrid" 
                    CurrentBrush="{Binding ElementName=ColorSelector, Path=SelectedItem}">
                </tilec:TileEditorGrid>
            </Viewbox>
        </Border>
        <StackPanel Orientation="Vertical" DockPanel.Dock="Right">
            <ListView x:Name="ColorSelector">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="3" Width="150">
                            <TextBlock TextAlignment="Center" Text="{Binding Path=Color}" 
                                       FontFamily="Verdana" FontSize="10"
                                       Background="{Binding}"/>
                        </Border>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackPanel>
    </DockPanel>
</Window>
